<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/6
 * Time: 15:24
 */

namespace app\modules\api\models;

use yii;
use yii\db\Query;

/**对应捷克负责人表
 * Class Leaders
 * @package app\modules\api\models
 */
class Leaders
{
    private $table;

    public function __construct()
    {
        $this->table = yii::$app->db->tablePrefix.'leaders';
    }

    public function list()
    {
        $db = new Query();
        $list = $db->select('*')->from($this->table)->all();
        return $list;
    }

    /**
     * @param $data
     * @return int
     */
    public function add($data)
    {
        $data['create_at'] = time();
        return yii::$app->db->createCommand()->insert($this->table,$data)->execute();
    }
}